package com.zhongyu.controller;

import com.zhongyu.pojo.Order;
import com.zhongyu.service.LuRuService;
import com.zhongyu.vo.PageResult;
import com.zhongyu.vo.ResultVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/sal/luru/")
public class LuRuController {

    @Resource
    private LuRuService luRuService;

    @GetMapping("/search/{pageNo}/{pageSize}")
    @RequiresPermissions("shenqing:list")
    public ResultVo search(@PathVariable Integer pageNo, @PathVariable Integer pageSize){
        PageResult pageResult=luRuService.searchAll(pageNo, pageSize);
        System.out.println(pageResult);
        return ResultVo.success(pageResult);
    }

    @GetMapping("/search")
    public ResultVo search(Integer id){
        List<Order> pageResult=luRuService.searchAll(id);
        return ResultVo.success(pageResult);
    }


}
